Scrapbox look-back function
2021-08-06 One click generates the following page
https://gyazo.com/5a863b3913690508695b5d0b210c2619
Intended use.
Click on the menu whenever you feel like it
View generated pages
Follow the link if you want to follow it.
If you want to rewrite the link, rewrite it.
I won't rewrite it, but if you want to comment on it, you can write a comment on this look back page like "I used to write this, but..."
They may look at multiple links and find relationships.
If you want to write it and then title it further and make it a stand-alone page, do so.
If you see something and don't feel like taking action, delete link.
Maybe this is important
If you don't do this, you'll have more meaningless links and your Scrapbox will become a garbage dump.
I think you should remove the links, even the ones that rewrite the page you linked to.
Because there's not much point in information that says, "I looked back at this day in retrospect."
Ideally, this look-back page should be used as a temporary home for the information generated by the look-back, and the page should eventually scatter and disappear.
If you can't find a good place to stay, you have no choice but to stay here, like Nodes of Thought. Comparison with previous version [ScrapboxSRS
I think we used to give out too many links.
It would be a burden to see it all.
There was an unnecessarily large amount of other information.
I hadn't seen them in three years, and I was like, "No, there's too many of them."
Interpretation of the meaning of the score is difficult and not good.
So I made it "100 days ago", "1 year ago", and "n years ago".
n years ago" is anything other than one year ago that is a near multiple of one year.
I made each section three.
I think about 9 3x3's is about right. This is the intention.
I used it.
I changed the external project link notation so that the link does not appear in the related pages list even if the link remains.
I see
2021-08-06
code:script.js
const LINE_PER_SECTION = 3;
const day = 60 * 60 * 24 * 1000;
const year = day * 365;
const project_name = scrapbox.Project.name;
const project_root = https://scrapbox.io/${project_name};
const menu_title = "Looking Back";.
const make_title = () => ${strftime(new Date())}${menu_title};
// score: 0 is best
const sections = [
{
title: "100 days ago",.
score: (diff) => Math.abs(diff - 100 * day),
},
{
title: "1 year ago",.
score: (diff) => Math.abs(diff - year),
},
{
title: "n years ago",.
score: (diff) => {
// excludes 1 year ago
if (diff < year * 1.5) {
return year;
}
const mod = diff % year;
return Math.min(mod, year - mod);
},
},
];
const main = () => {
// calc scores
const now = Date.now();
const scored_pages = [];
scrapbox.Project.pages.forEach((page) => {
const updated = page.updated;
if (updated === 0) return;
const diff = now - updated * 1000;
const p = { ...page };
sections.forEach((sction) => {
});
scored_pages.push(p);
});
// generate page contents
const lines = [];
sections.forEach((section) => {
lines.push(section.title);
scored_pages.slice(0, LINE_PER_SECTION).forEach((page) => {
const date = strftime(new Date(page.updated * 1000));
lines.push( ${date} [${title}]);
});
lines.push("");
});
create_page(make_title(), lines);
};
function create_page(title, lines) {
const body = encodeURIComponent(lines.join("\n"));
window.open(${project_root}/${title}?body=${body});
}
function pad(number) {
if (number < 10) {
return "0" + number;
}
return number;
}
function strftime(d) {
return (
d.getUTCFullYear() +
"-" +
pad(d.getUTCMonth() + 1) +
"-" +
pad(d.getUTCDate())
);
}
const WAIT = { title: "Please wait...", image: null, onClick: () => null };
const onClick = () => {
scrapbox.PageMenu(menu_title).addItem(WAIT);
main();
scrapbox.PageMenu(menu_title).removeAllItems();
};
scrapbox.PageMenu.addMenu({
title: menu_title,
onClick,
});
old version
2018-05-25
orthographical variants
---
This page is auto-translated from /nishio/Scrapbox振り返り機能. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.